
package net.lovesrc.allin.biz.dida;

import com.alibaba.fastjson.JSONObject;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

@Data
public class Listing {

    private Long id;
    private BigDecimal asPassengerAverageScore;
    private Date createTime;
    private BigDecimal driverReceivedPrice;
    private Poi fromPoi;
    private Integer matchLevel;
    private Integer matchPercent;
    private PassengerUserInfo passengerUserInfo;
    private Integer personNum;
    private String planStartTime;
    private BigDecimal price;
    private String priceText;
    private Integer relation;
    private RelationShip relationShip;
    private Integer reviveable;
    private String status;
    private Integer thanksPrice;
    private Integer timeScaleMins;
    private Integer timeType;
    private Poi toPoi;
    private Integer type;
    private String originText;
    private long insertTime;

    private JSONObject origin;

    @Override
    public int hashCode() {
        return passengerUserInfo.getCid().hashCode();
    }

    @Override
    public boolean equals(Object o) {
        if (!(o instanceof Listing)) {
            return false;
        }
        Listing other = (Listing) o;
        if (!other.getPassengerUserInfo().getCid().equalsIgnoreCase(other.getPassengerUserInfo().getCid())) {
            return false;
        }
        if (!other.getFromPoi().getShortAddress().equalsIgnoreCase(other.getFromPoi().getShortAddress())) {
            return false;
        }
        if (!other.getToPoi().getShortAddress().equalsIgnoreCase(other.getToPoi().getShortAddress())) {
            return false;
        }
        return true;
    }

}
